package com.kerbores.kop.common;

import org.nutz.lang.Lang;
import org.nutz.lang.Strings;

public class SignUtil {

	public static String sign(String method, String ak, String sk, int length) {
		return Lang.md5(method + ak + length + sk);
	}

	public static boolean check(String sign, String method, String ak, String sk, int length) {
		return Strings.equals(sign, sign(method, ak, sk, length));
	}
	public static String getFirstChar(String in) {
		if (in == null || in.length() < 1) {
			return "0";
		}
		return in.substring(0, 1);
	}

}
